package cn.zdm.demo2.auth.service.impl;

import cn.zdm.demo2.auth.mapper.IosAppAuthPoMapper;
import cn.zdm.demo2.auth.model.dto.AuthDTO;
import cn.zdm.demo2.auth.model.po.IosAppAuthPO;
import cn.zdm.demo2.auth.service.IosAppAuthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * copyright (C), 2021, 武大吉奥科技有限公司
 *
 * @Program demo2
 * @Description
 * @Author ZhaoDeman
 * @Create 2021/1/19 23:00
 * @Version 1.0.0
 * <author>                <time>                  <version>                   <description>
 * ZhaoDeman        2021/1/19 23:00                 1.0
 */
@Service
@Slf4j
public class IosAppAuthServiceImpl extends ServiceImpl<IosAppAuthPoMapper, IosAppAuthPO> implements IosAppAuthService {

    @Autowired
    private IosAppAuthPoMapper iosAppAuthPoMapper;
    

    /**
     * 添加
     *
     * @param iosAppAuthPO
     * @return
     */
    @Override
    public Integer saveAppAuth(IosAppAuthPO iosAppAuthPO) {
        try {
            iosAppAuthPoMapper.insert(iosAppAuthPO);
            return 1;
        } catch (Exception e) {
            log.info("====>{}", e);
        }
        return 0;
    }

    /**
     * 查询全部的权限信息
     *
     * @return
     */
    @Override
    public List<IosAppAuthPO> queryIosAuth() {
        return iosAppAuthPoMapper.queryAppAuthInfo();
    }

    /**
     * 分页查询
     *
     * @param authDTO
     * @return
     */
    @Override
    public List<IosAppAuthPO> queryIosAuthByPage(AuthDTO authDTO) {
        return iosAppAuthPoMapper.queryAppAuthInfoByPage(authDTO);
    }

    /**
     * 根据权限id删除数据
     *
     * @param id
     * @return
     */
    @Override
    public Boolean delIosAuth(String id) {
        return iosAppAuthPoMapper.deleteById(id) > 0 ? true : false;
    }
}
